﻿@model WebStatus.Viewmodels.HealthStatusViewModel

@{
    ViewData["Title"] = "System Status";
}


<div class="row">
    <div class="col-md-12">
        <h2 class="overall-status-title">Overall Status: @Model.OverallStatus</h2>
    </div>
</div>

<div class="list-group-status">
    @foreach (var result in Model.Results)
    {
        <div class="row list-group-status-item">
            <div class="col-md-10">
                <h4 class="list-group-status-item-title">@result.Name</h4>
                <p class="list-group-item-text">
                    @if (result.Result.Data.ContainsKey("url")) {
                        <p>@result.Result.Data["url"]</p>
                    }
                @result.Result.Description
                </p>
            </div>
            <div class="col-md-2 list-group-status-item-label">
                @if (@result.Result.CheckStatus == Microsoft.Extensions.HealthChecks.CheckStatus.Healthy)
                {
                    <span class="label label-success">@result.Result.CheckStatus</span>
                }
                else if (@result.Result.CheckStatus == Microsoft.Extensions.HealthChecks.CheckStatus.Unhealthy)
                {
                    <span class="label label-danger">@result.Result.CheckStatus</span>
                }
                else if (@result.Result.CheckStatus == Microsoft.Extensions.HealthChecks.CheckStatus.Warning)
                {
                    <span class="label label-warning">@result.Result.CheckStatus</span>
                }
                else
                {
                    <span class="label label-default">@result.Result.CheckStatus</span>
                }
            </div>
        </div>        
    }
</div>